package com.stone.customer.infra.lock.factory;

import com.stone.customer.infra.lock.RedisLock;
import com.stone.customer.infra.lock.impl.ReentrantRedisLock;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;

/**
 * 锁工厂
 *
 * @author Mr_wenpan@163.com 2021/07/23 23:07
 */
@Component
public class RedisLockFactory {

    @Autowired
    private StringRedisTemplate redisTemplate;

    public RedisLock getReentrantLock(String key) {
        return new ReentrantRedisLock(redisTemplate, key);
    }

}
